﻿package com.pandemicode.framework.utils {
	import flash.media.Sound;
	import flash.media.SoundTransform;
	
	/**
	* @author Michael Lawrence
	* @version 1.0.0
	*/
	public class SoundHelper {
		/**
		 * A series of helpful methods for dealing with sounds.
		 */
		public function SoundHelper() { }
		
		/**
		 * A simple method for playing a sound.
		 * @param	sound			The class of the sound to play.
		 * @param	startTime		The start time of the sound to play.
		 * @param	loops			The number of times to repeat the sound. 0 is infinate.
		 * @param	sndTransform	The SoundTransform to use when playing the sound.
		 */
		public static function PlaySound(sound:Class, startTime:Number = 0, loops:int = 0, sndTransform:SoundTransform = null):void {
			if(sound != null) {
				var s:* = new sound();
				if (s is Sound)
					(s as Sound).play(startTime, loops, sndTransform);
			}
		}
	}
}